package cn.shop.merchant.controller;

import cn.shop.transcation.merchantUser.mapper.entity.MerchantUser;
import cn.shop.utils.enums.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author : 李一涵
 * @date : Created in 2021-11-1 10:29
 * @description : 测试
 */
@RestController
public class WhoAmI {

    private static final Logger LOG = LoggerFactory.getLogger("WhoAmI");

    @GetMapping("/test")
    public Object test() {
        LOG.info("测试日志{} {}", "a", Status.DISABLE);
        LOG.info("DB:测试日志{} {}", "a", Status.DISABLE);
        //System.out.println(status);
        return "ok";
    }

    @PostMapping("/test2")
    public Object test(@RequestBody MerchantUser user) {
        System.out.println(user);
        return user;
    }

    public static void main(String[] args) {
        List<Status> statuses = new ArrayList<>();
        statuses.add(Status.DISABLE);
        statuses.add(Status.NORMAL);
        //statuses.add(Status.NORMAL);
        boolean has = statuses.stream().map(Status::code).anyMatch(s -> s == 2);
        System.out.println(has);
        //System.out.println(DigestUtil.bcrypt("123456789"));
    }
}
